<template>
  <div></div>
</template>

<script setup>
import { mall } from '../http/index'
import { useRoute, useRouter } from 'vue-router'
import { ref, onMounted, toRaw } from 'vue'

const router = useRouter()
const route = useRoute()

let userInfo = ref({})
// 获取用户信息
const getUser = (userID) => {
  let service = "qryUserInfo"
  let serviceData = {
    userID,
    fromDate: "",
    toDate: "",
    start: 0,
    length: 1,
  }
  mall("/user", service, serviceData).then(res => {
    if (res.resultCode == 1) {
      let user = res.result[0]
      userInfo.value = user
      sessionStorage.setItem("mallUserInfo", JSON.stringify(user))
      sessionStorage.setItem("MUserID", user.outUserID)
      sessionStorage.setItem("HUserID", user.userid)
      sessionStorage.setItem("userName", user.username)
      sessionStorage.setItem("linkTel", user.linktel)
    }
  })
}
// 店铺信息查询
const getShop = (shopCode) => {
  let service = "qryShopInfo"
  let serviceData = {
    shopCode,
    start: 0,
    length: 9,
  }
  mall("/shop", service, serviceData).then(res => {
    if (res.resultCode == 1 && res.result.length > 0) {
      let shopInfo = res.result[0]
      sessionStorage.setItem("shopInfo", JSON.stringify(shopInfo))
      sessionStorage.setItem("shopCode", shopInfo.shopcode)
    }
  })
}

onMounted(() => {
  // let userData = toRaw(route.query)
  // getUser(userData.userid)
  // getShop(userData.shopCode)
  getUser('13DC78E9-2900-4950-BEBD-BFFE44D0EB4A')
  getShop('504D5D21-D3B4-406E-A07F-BCF9A33F1D7D')
})
</script>

<style scoped lang="scss">
</style>